module PrismBreak {

    export class View {
        private frameworkApp: PbApp;

        public Id: string;
        public ViewModel: any;
        public Node: HTMLElement;
        public Region: Region;

        constructor(frameworkApp: PbApp, id: string, vm: any, node: HTMLElement, region: Region) {
            this.frameworkApp = frameworkApp;
            this.Id = id;
            this.ViewModel = vm;
            this.Node = node;
            this.Region = region;
        }


        public Deactivate(): View {

            //var jnode = $(this.Node);

            //jnode.removeClass(PrismBreak.ViewClass[PrismBreak.ViewClass.pb_visible]);

            //if (!jnode.hasClass(PrismBreak.ViewClass[PrismBreak.ViewClass.pb_invisible])) {
            //    jnode.addClass(PrismBreak.ViewClass[PrismBreak.ViewClass.pb_invisible]);
            //}

            if ("Deactivated" in this.ViewModel) {
                this.ViewModel["Deactivated"]();
            }

            return this;

        }

        public Activate(): View {
            //var jnode = $(this.Node);

            //jnode.removeClass(PrismBreak.ViewClass[PrismBreak.ViewClass.pb_invisible]);

            //if (!jnode.hasClass(PrismBreak.ViewClass[PrismBreak.ViewClass.pb_visible])) {
            //    jnode.addClass(PrismBreak.ViewClass[PrismBreak.ViewClass.pb_visible]);
            //}

            if ("Activated" in this.ViewModel) {
                this.ViewModel["Activated"]();
            }

            this.frameworkApp.EventManager.Publish(PrismBreak.EventType[PrismBreak.EventType.ViewActivated], this);


            return this;
        }
    }
}